#ifndef CAPP_H
#define CAPP_H
 
#include "event.h"
#include "surface.h"
#include "define.h"
#include "animation.h"
#include "entity.h"
#include "field.h"
#include <SDL/SDL.h>

/**
 * \brief The main application class.
 * 
 * It inherits Events to properly catch and process SDL events.
 * */

class CApp : public Event {
    private:
        bool    Running;
        SDL_Surface*    Surf_Display;
        
        
        Entity  entity1;
        Entity  entity2;

        Field   gameField;
    public:
    
        TurnStateT  turnState;
        CApp();
        
        /**< This function is called to actually execute an application and cycle through all it's loops.
         *  It calls Init() as initialization step,
         *  OnEvent() processing step,
         *  Loop() for processing data and doing game logics,
         *  Render() to render things on the display.
         *  It calls Cleanup() to quit gracefully and remove all the garbage.
         */
        int Execute();
 
        bool Init();        /**< This function initialize the whole SDL stack and sets the graphics parameters.  */
 
        void OnEvent(SDL_Event* evnt); /**< This function is used to react on user's input and process game and system events.
                                        *    Takes pointer to SDL_Event structure and properly processes all the events queue. */
 
        void Loop();    /**< Used to process any game logics and actually does something (apart from reacting). */
 
        void Render();  /**< Renders all the picture on the screen. */
 
        void Cleanup();
        
        void Exit();
        
        static TurnStateT  turnState;
        
        void OnLButtonDown(int mX, int mY);
};
 
#endif